public with sharing class PagingUserController {
 
    // instantiate the StandardSetController from a query locator
    public ApexPages.StandardSetController con {
        get {
            if(con == null) {
                con = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id, Name,email, isactive , attuid__C,LastModifiedDate, LastLoginDate, CreatedDate FROM user Order By LastLoginDate desc limit 500]));
                // sets the number of records in each page set
                con.setPageSize(50);
            }
            return con;
        }
        set;
    }
 
    // returns a list of wrapper objects for the sObjects in the current page set
    public List<User> getUsers() {
          return (List<User>) con.getRecords();
    }
 
    // returns a list of wrapper objects for the sObjects in the current page set
    public void save() {
          con.save();
    }
 
    // indicates whether there are more records after the current page set.
    public Boolean hasNext {
        get {
            return con.getHasNext();
        }
        set;
    }
 
    // indicates whether there are more records before the current page set.
    public Boolean hasPrevious {
        get {
            return con.getHasPrevious();
        }
        set;
    }
 
    // returns the page number of the current page set
    public Integer pageNumber {
        get {
            return con.getPageNumber();
        }
        set;
    }
 
    // returns the first page of records
    public void first() {
        con.first();
    }
 
    // returns the last page of records
    public void last() {
        con.last();
    }
 
    // returns the previous page of records
    public void previous() {
        con.previous();
    }
 
    // returns the next page of records
    public void next() {
        con.next();
    }
 
    // returns the PageReference of the original page, if known, or the home page.
    public void cancel() {
        con.cancel();
    }
 
}